package com.sl.mes.db.service.puboid;

import com.sl.mes.db.dao.PubOidMapper;
import com.sl.mes.db.itf.puboid.IPubOid;
import com.sl.mes.db.vo.PubOid;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class PubOidDaoService implements IPubOid {

    @Resource
    private PubOidMapper pubOidMapper;

    /**
     * 通过主键来查询
     *
     * @param group
     * @return
     */
    @Override
    public PubOid findPubOidById(String group) {
        return pubOidMapper.selectByPrimaryKey(group);
    }

    /**
     * 通过主键删除
     *
     * @param group
     */
    @Override
    public int deletePubOidById(String group) {
        return pubOidMapper.deleteByPrimaryKey(group);
    }

    /**
     * 添加
     *
     * @param pubOid
     */
    @Override
    public PubOid insertPubOid(PubOid pubOid) {
        int count = pubOidMapper.insert(pubOid);
        if (count > 0) {
            return pubOid;
        } else {
            return null;
        }
    }

    /**
     * 修改
     *
     * @param pubOid
     */
    @Override
    public int updataPubOid(PubOid pubOid) {
        return pubOidMapper.updateByPrimaryKey(pubOid);
    }

}
